<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$item=$this->plugin_setting('basic');
//print_r($item['image']);exit;
$return['banner']=$item['image'];
$return['setting']=$item;
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	$postdata=get_postdata();
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
    $fields=array('id','title','remark','status','image','paixu');
    $orderby='paixu asc';
	$total='';
	$return['list']=pdo_getslice('jy_cmsphoto_classify',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	//print_r($return['list']);exit;
	exi($return);
	}
if($_RQ['op']=='detail'){
	$id=intval($_RQ['id']);
	if(!$id){
		exi('请选择分类','error','jy_cmsphoto/classify/');
	}
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'cid'=>$id);
	$postdata=get_postdata();
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
    $fields=array('id','title','remark','status','image','images','paixu');
    $orderby='paixu asc';
	$total='';
	$return['list']=pdo_getslice('jy_cmsphoto_photo',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	//print_r($return['list']);exit;
	exi($return);
}
if($_RQ['op']=='photo'){
	$id=intval($_RQ['id']);
	if(!$id){
		exi('请选择相册','error','jy_cmsphoto/photo/');
	}
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'id'=>$id);
	$postdata=get_postdata();
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
    $fields=array('id','title','remark','status','image','images','paixu');
    $orderby='paixu asc';
	$total='';
	$photo=pdo_getslice('jy_cmsphoto_photo',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	$return['list']=json_decode($photo['0']['images'],true);
//	print_r($return['list']);exit;
	exi($return);
}
?>